<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>Sl8</title>
	</head>
	<body>
		<template>
			<div class="home">
				<h2>登录后主页</h2>
			</div>
		</template>
		
		<script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
		<script src="https://unpkg.com/vue-router/dist/vue-router.js"></script>
		<script>
			export default{
				data(){
					return{
						name:"amy"
					};
				},
				beforeRouteEnter(to,from,next){
					console.log("路由被调用了");
					next();
				},
				beforeRouteUpdate(to,from,next){
					//在当前路由改变，但是该组件被复用时调用
					console.log(this.name);
					next();
				},
				beforeRouteLeave(to,from,next){
					//导航离开该组件的对应路由时调用
					console.log("去往的页面路径：",to.path);
					next();
				}
			};
		</script>
	</body>
</html>
